package com.gxa.jjty.core.pojo;

import com.gxa.jjty.core.group.AddGroup;
import com.gxa.jjty.core.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * Created with IntelliJ IDEA.
 *
 * @author : 宸濯
 * Date: 2021/12/03 11:27
 * Description:
 * Version: V1.0
 */
@Data
@ApiModel
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "address")
public class Address {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty("地址编号")
    @NotNull(message = "地址编号不能为空",groups = UpdateGroup.class)
    private Long id;

    @Column(name = "handicapped_id")
    @ApiModelProperty("残疾人id")
    @NotNull(message = "残疾人编号不能为空",groups ={AddGroup.class,UpdateGroup.class})
    private Long handicappedId;

    @Column(name = "name")
    @ApiModelProperty("姓名")
    @NotEmpty(message = "姓名不能为空",groups ={AddGroup.class,UpdateGroup.class})
    private String name;

    @Column(name = "sex")
    @ApiModelProperty("性别")
    @NotNull(message = "性别不能为空",groups ={AddGroup.class,UpdateGroup.class})
    private Boolean sex;

    @Column(name = "phone")
    @ApiModelProperty("电话")
    @NotEmpty(message = "电话不能为空",groups ={AddGroup.class,UpdateGroup.class})
    private String phone;

    @Column(name = "area")
    @ApiModelProperty("所在区域")
    @NotEmpty(message = "所在区域不能为空",groups ={AddGroup.class,UpdateGroup.class})
    private String area;

    @Column(name = "detail")
    @ApiModelProperty("详细地址")
    @NotEmpty(message = "详细地址不能为空",groups ={AddGroup.class,UpdateGroup.class})
    private String detail;

    @Column(name = "address_primary")
    @ApiModelProperty("是否是默认地址")
    @NotNull(message = "默认地址不能为空",groups = UpdateGroup.class)
    private Boolean addressPrimary;
}
